<?php

namespace App\Http\Controllers\WeChat;

use App\Http\Controllers\Controller;
use App\Models\BalanceRecord;
use App\Models\OrderUser;
use Dingo\Api\Routing\Helpers;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Support\Facades\DB;
use Tymon\JWTAuth\Facades\JWTAuth;
use App\Models\User;
use EasyWeChat\Foundation\Application;
use Log;

/**
 * Class WeChatController
 * @package App\Http\Controllers\WeChat
 * 微信认证
 */
class WeChatAuthController extends Controller
{

    use AuthenticatesUsers;
    use Helpers;
    //获取日志信息
    public function getLog(){
        $url='/var/www/rentmaterial/storage/logs/debug.log';
        $text=file_get_contents($url);
        echo $text;
    }
    public function test()
    {
        $orderUserCount=OrderUser::where('order_id',11)->sum('send_money')+OrderUser::where('order_id',11)->sum('spread_amount');

        dd($orderUserCount);
    }

    //清空订单相关的表
    public function orderTruncate()
    {
        DB::table('balance_record')->truncate();
        DB::table('platform_income')->truncate();
        DB::table('cart')->truncate();
        DB::table('deal_record')->truncate();
        DB::table('demand')->truncate();
        DB::table('notice')->truncate();
        DB::table('order')->truncate();
        DB::table('order_user')->truncate();
        DB::table('order_goods')->truncate();
        DB::table('sms_code')->truncate();
        DB::table('withdraw')->truncate();
        DB::table('wx_template_message')->truncate();
        DB::table('depot')->update(['total'=>1,'lock_num'=>0,'can_sale_num'=>1]);
        echo 'ok';

    }



}
